package com.ning.activitys.skysound.adpter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.ning.activitys.skysound.fragment.musicpavilion.MusicListFragment;
import com.ning.activitys.skysound.fragment.musicpavilion.SingerFragment;
import com.ning.activitys.skysound.fragment.musicpavilion.RankingListFragment;
import com.ning.activitys.skysound.fragment.musicpavilion.RadioFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 16/1/8.
 */
public class MusicPavilionAdapter extends FragmentPagerAdapter{

    private List<Fragment> fragments;
    private String titles[] = {"电台","歌单","排行榜","歌手"};

    public MusicPavilionAdapter(FragmentManager fm) {
        super(fm);
        fragments = new ArrayList<>();
        Fragment recommended = new RadioFragment();
        Fragment musicList = new MusicListFragment();
        Fragment rankingList = new RankingListFragment();
        Fragment radio = new SingerFragment();
        fragments.add(recommended);
        fragments.add(musicList);
        fragments.add(rankingList);
        fragments.add(radio);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}

